package com.queming.core.config;

import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author chencidiao
 * @date 2022/04/30 09:04
 **/
@Configuration
public class WechatConfig {
    @Value("${wechat-appId}")
    private String appId;
    @Value("${wechat-appSecret}")
    private String appSecret;
    @Bean
    WxMpService wxMpService(){
        WxMpService wxMpService=new WxMpServiceImpl();
        WxMpDefaultConfigImpl config = new WxMpDefaultConfigImpl();
        config.setAppId(appId);
        config.setSecret(appSecret);
        wxMpService.setWxMpConfigStorage(config);
         return wxMpService;
    }
}
